<template>
	<view class="page" >
		<view class="user-info-block">
			<view class="user-info-left">
				<image :src="addInfo.headPic" mode="" class="user-info-left"></image>
			</view>
			<view class="user-info-right">
				<view class="user-info-name">
					{{addInfo.nickName}}
				</view>
				<view class="user-sex-age">
					<text class="user-sex">{{addInfo.sex === 1 ? '男' : '女'}}</text>
					<text class="user-age">{{addInfo.age}}岁</text>
				</view>
			</view>
		</view>
		
		<view class="min-title">
			填写验证信息
		</view>
		<view class="verify-block">
			<view class="verify-info">
				<textarea class="verify-info-textares" v-model="addRequest.verifyInfo" placeholder="请填写验证信息" />
			</view>
		</view>
		
		<view class="min-title">
			设置备注和分组
		</view>
		<view class="remark-and-group">
			<view class="remark">
				<text class="label-name">备注</text>
				<input type="text" v-model="addRequest.remark" />
			</view>
			<view class="group">
				<text class="label-name">分组</text>
				<view class="group-choice">
					<text class="group-name">{{addRequest.group}}</text>
					<text class="group-navation iconfont icon113fangxiang_xiangyou"></text>
				</view>
			</view>
		</view>
		
		<view class="is-dynamic">
			<text class="label-name">不让他看我的动态</text>
			<switch :checked="addRequest.isDynamic" color="#0ED900"  @change="addRequest.isDynamic = !addRequest.isDynamic" />
		</view>
		
	</view>
</template>

<script>

	import msg from "../../../api/message.js"
	var _self
	
	export default {
		data() {
			return {
				addInfo: {},
				addRequest:{
					verifyInfo: "", // 验证消息
					remark: "", // 备注
					group: "家人", //分组
					isDynamic: false // 是否
				},
				message: this.utils.message, // 消息实例
			}
		},
		onNavigationBarButtonTap(data) {
			if(data.text === "发送"){
				// 发送好友申请
				if(_self.addInfo.id !== undefined){
					_self.message.receiver = _self.addInfo.id
					_self.message.type = 12
					_self.message.context = JSON.stringify(_self.addRequest)
					console.log(_self.message)
					msg.sendMessage(_self.message)
				}
				
			}else {
				// 返回
				uni.navigateBack({
					delta: 1,
					animationDuration: 500,
					animationType: "slide-out-right"
				})
			}
		},
		onLoad(data) {
			_self = this
			if(data.result !== undefined){
				_self.addInfo = JSON.parse(data.result)
			}
			
		},
		methods: {
			
		},
		components:{
		}
	}
</script>

<style>
	@import url("addFriend.css");
</style>
